﻿@model Coevery.Relationship.Models.ReferenceFieldViewModel
@using System.Web.Mvc.Html
@using Coevery.Relationship.Settings
@using Orchard.Mvc.Html
@{
    var settings = Model.Field.PartFieldDefinition.Settings.GetModel<ReferenceFieldSettings>();
    var required = settings.Required ? "required" : null;
    var selectAttributes = new Dictionary<string, object> { { "class", "textMedium span12" } };
    if (settings.Required) {
       selectAttributes.Add("required","");
    }
    
    if(!string.IsNullOrWhiteSpace(settings.HelpText))
    {
        selectAttributes.Add("helper:text", settings.HelpText);
    }
}
<label class="span3 control-label @required" for="@Html.FieldIdFor(m => m.ContentId)">@Model.Field.DisplayName</label>
<div class="control controls errortips">
    @Html.DropDownListFor(m => m.ContentId, Model.ItemList,string.Empty, selectAttributes)
</div>

